﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SKYPE4COMLib;
namespace SkypeApp
{
    public partial class SkypeUser : UserControl
    {
        Color Default;

        public event EventHandler ButtonClicked;

        DisplayUser user;

        public DisplayUser User
        {
            get
            {
                return user;
            }
            set
            {
                user = value;
                UpdateControl();
            }
        }

        private void UpdateControl()
        {
            buttonCall.Text = User.DisplayText;
            Enabled = User.Enabled;
            var color = Enabled ? Color.LawnGreen : Default;
            this.buttonCall.BackColor = color;
        }

        public SkypeUser()
        {
            InitializeComponent();
            Default = this.BackColor;
        }

        private void buttonCall_Click(object sender, EventArgs e)
        {
            if (ButtonClicked != null)
                ButtonClicked(this, e);
        }
    }
}
